﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WcfService;
using System.ServiceModel;

namespace WcfHosting
{
    class Program
    {
        private static ServiceHost host;

        static void Main(string[] args)
        {
            Methon_Init();
            Console.Read();

            host.Close();
        }
        public static void Methon_Init()
        {
            Method_1();
            Method_2();
            Method_3();
            Method_SayHelloCallBack();
        }
        public static void Method_1()
        {
            host = new ServiceHost(typeof(WcfService.WCFService));

            //判断是否以及打开连接，如果尚未打开，就打开侦听端口
            if (host.State != CommunicationState.Opening)
                host.Open();
            //显示运行状态
            Console.WriteLine("WCFService Host is runing! and state is {0}", host.State);
            //等待输入即停止服务

        }
        public static void Method_2()
        {
            host = new ServiceHost(typeof(WcfService.WCFOverLoadingService));

            if (host.State != CommunicationState.Opening)
                host.Open();
            Console.WriteLine("WCFOverLoadingService Host is runing! and state is {0}", host.State);
            //等待输入即停止服务

        }
        public static void Method_3()
        {
            host = new ServiceHost(typeof(WcfService.OperateUseAccount));

            //判断是否以及打开连接，如果尚未打开，就打开侦听端口
            if (host.State != CommunicationState.Opening)
                host.Open();
            //显示运行状态
            Console.WriteLine("OperateUseAccount Host is runing! and state is {0}", host.State);
            //等待输入即停止服务

        }
        public static void Method_SayHelloCallBack()
        {
            host = new ServiceHost(typeof(WcfService.WCFServiceCB));

            if (host.State != CommunicationState.Opened)
            {
                host.Open();
            }
            Console.WriteLine("WCFServiceCB Host is runing! and state is {0}", host.State);
        }
    }
}
